const express = require('express');
const router = express.Router();
const service = require("../service/userTelService");
const PATH = "/userTel";

router.get('/info/:id', async function(req, res, next) {
  res.send((await service.queryById(req.params.id)));
})

router.post('/edit', async function(req, res, next) {
  res.send((await service.update(req.body)));
})

router.get('/listPage', async function(req, res, next) {
  // req.session.user = {id: req.body.user_id}
  res.send((await service.queryByPage(req.query)));
})

module.exports = (app)=>{
  app.use(PATH, router);
}
